class Solution
{
public:
	bool solve(string A, string B)
	{
		if (A.size() != B.size()) return false;
		return (A + A).find(B) != -1;
	}
};